<?php

namespace app\web\model;
use think\Db;
use think\Model;
use think\Session;

class CartModel extends Model
{
    public function cartmess()
    {

        $tableid = 36;
        $res = Db::table('cart') ->field('*') ->where('id',$tableid) ->select();
        $cid = Db::table('cart')->field('cart.goodsid')->where('cart.tableid',$tableid)->select();
       // var_dump(count($cid));die;
        if(!empty($cid)){
            for($a=0; $a<count($cid); $a++){
                $ppic = Db::table('goods') ->field('pictrue, details') ->where('id',$cid[$a]['goodsid']) ->select();
                $pic[$a] = $ppic[0];
                // var_dump($pic[$a]);
            }
                   // var_dump($this->getLastsql());
            // var_dump($pic);die;
            // echo 111;die;
            for($b=0; $b<count($pic); $b++){
                $res[$b]['pictrue'] = $pic[$b]['pictrue'];
                $res[$b]['details'] = $pic[$b]['details'];
            }
        }else{
            $res = false;
        }

       // var_dump($res);die;
       // echo 111;die;
        return $res;
    }

}








